#include "qprojecthost.h"

#include "../property/qabstractproperty.h"
#include "../property/qpropertyfactory.h"


QProjectHost::QProjectHost(QAbstractHost *parent):
    QAbstractHost(parent)
{
    setProperty("title",PROJECT_HOST_TITLE);
}

void QProjectHost::create_object()
{
    m_object=new QObject;
}

void QProjectHost::init_property()
{
    QAbstractHost::init_property();
    QAbstractProperty* pro;

    pro=QPropertyFactory::create_property("ByteArray");
    if(pro!=NULL)
    {
        pro->set_property("name","objectName");
        pro->set_attribute("show_name",tr("Name"));
        pro->set_attribute(ATTR_EDITABLE,false);
        pro->set_attribute(ATTR_NEED_UPDATE,true);
        pro->set_attribute("group","Attributes");
        insert_property(pro);
    }

    pro=QPropertyFactory::create_property("ByteArray");
    if(pro!=NULL)
    {
        pro->set_property("name","projectPath");
        pro->set_attribute("show_name",tr("Project Path"));
        pro->set_attribute(ATTR_EDITABLE,false);
        pro->set_attribute("group","Attributes");
        insert_property(pro);
    }

    pro=QPropertyFactory::create_property("Enum");
    if(pro!=NULL)
    {
        pro->set_property("name","start_user");
        pro->set_attribute("show_name",tr("User"));
        pro->set_attribute("group","Attributes");
        pro->set_attribute(ATTR_NEEDSAVE,true);
        pro->set_attribute(ATTR_NEED_UPDATE,true);
        insert_property(pro);
    }

    pro=QPropertyFactory::create_property("Enum");
    if(pro!=NULL)
    {
        pro->set_property("name","start_language");
        pro->set_attribute("show_name",tr("Language"));
        pro->set_attribute("group","Attributes");
        pro->set_attribute(ATTR_NEEDSAVE,true);
        pro->set_attribute(ATTR_NEED_UPDATE,true);
        insert_property(pro);
    }

    pro=QPropertyFactory::create_property("Enum");
    if(pro!=NULL)
    {
        pro->set_property("name","start_page");
        pro->set_attribute("show_name",tr("Page"));
        pro->set_attribute("group","Attributes");
        pro->set_attribute(ATTR_NEEDSAVE,true);
        pro->set_attribute(ATTR_NEED_UPDATE,true);
        insert_property(pro);
    }

    pro=QPropertyFactory::create_property("Size");
    if(pro!=NULL)
    {
        pro->set_property("name","designer_size");
        pro->set_attribute("show_name",tr("Design Size"));
        pro->set_attribute("group","Attributes");
        m_object->setProperty("designer_size",QSize(800,600));
        insert_property(pro);
    }

    pro=QPropertyFactory::create_property("Size");
    if(pro!=NULL)
    {
        pro->set_property("name","running_size");
        pro->set_attribute("show_name",tr("Running Size"));
        pro->set_attribute("group","Attributes");
        pro->set_attribute(ATTR_NEED_UPDATE,true);
        m_object->setProperty("running_size",QSize(800,600));
        insert_property(pro);
    }
}
